import { defineStore } from "pinia";
import piniaPersistConfig from "@/config/piniaPersist";

export const usePiniaStudyStore = defineStore({
  id: "geeker-piniaStudy",
  state: () => ({
    nums: 1,
    myObj: { obj: "ljj", age: 12, sex: "男" },
    myArr: [1, 2, 3, 4, 5]
  }),
  getters: {},
  actions: {
    setNums(nums) {
      console.log("this", this.$patch);
      console.log("nums", nums);
      this.nums = nums;
    },
    setMyObj(myObj) {
      this.myObj = myObj;
    },
    setMyArr(myArr) {
      this.myArr = myArr;
    }
  },
  persist: piniaPersistConfig("geeker-piniaStudy")
});
